
f = open("win_data.txt", "rb")

# print(f.read())

# s = f.read()
# print(type(s))

# 读取
s = f.read()
f.close()

print(s.decode("gbk"))

# 转码
s_unicode = s.decode("gbk") #转成unicode

s_utf8 = s_unicode.encode("utf-8")

# 写入
f = open("win_data.txt", "wb")

f.write(s_utf8)

f.close()

# 二进制模式 rb wb ab
# r 文本模式  把二进制解码成 字符串 unicode